package com.hstc.controller;
import jakarta.annotation.Resource;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RestController
public class McpClientController {
    @Resource
    private ChatClient chatClient;

    @Resource
    private ChatModel chatModel;

    @GetMapping("/mcp/chatclient")
    public Flux<String> mcpChatClient(@RequestParam(name = "msg",defaultValue = "北京") String msg){
        return chatClient.prompt(msg)
                .stream()
                .content();
    }

    @GetMapping("/mcp/chatmodel")
    public Flux<String> mcpChatModel(@RequestParam(name = "msg",defaultValue = "北京") String msg){
        return chatModel.stream();
    }

}
